package com.alibaba.dubbo.demo.web.app.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.dubbo.demo.web.entity.User;
import com.alibaba.dubbo.demo.web.service.UserService;

@Controller
@RequestMapping("/user")
public class UserController {

    @Autowired
    UserService userService;

    @RequestMapping("/login")
    @ResponseBody
    public boolean login(String userName, String password) {
        return userService.login(userName, password);
    }

    @RequestMapping("/logout")
    @ResponseBody
    public boolean logout(String token) {
        return userService.logout(token);
    }

    @RequestMapping("/getDetail")
    @ResponseBody
    public User getDetail(int id){
        return userService.getDetail(id);
    }
}
